#pragma once

template <typename In, 
          typename Limit>
class Limiter
{
public:
    typedef typename In::ReturnType ReturnType;
    typename In::ReturnType operator()()
    {
        return std::min(in_(), static_cast<typename In::ReturnType>(limit_()));
    }
private:
    In in_;
    Limit limit_;
};
